<?php
namespace app\team\model;

use think\Model;
use think\Request;
use think\Db;
use think\Session;

class Team extends Model
{

    /**
     * @param $id
     * @param array $field
     * @param array $where
     * @return array|false|\PDOStatement|string|\think\Model
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */

    static function getTourById($id,$field = array(),$where = array()){

        if(empty($field)){

            return Db::name('team')->where($where)->where("team_id",$id)->find();

        }else{

            $field = implode(',',$field);

            return Db::name('team')->field($field)->where($where)->where("team_id",$id)->find();

        }

    }

    static function getTeamList($where=array(),$field=array())
    {
        if(empty($field)) {

            return Db::name('team')->where($where)->find();
        }else{
            $field = implode(',',$field);
            $res = Db::name('team')->field($field)->where($where)->select();
            foreach ($res as $k=>$v){
                $res[$k]['time'] = $v['team_start_time'].'~'.$v['team_end_time'];
            }
            return $res;
        }

    }
}
